Page({
  onLoad({ id }) {
    this.getHouseDetail(id)
    this.setData({
      id,
    })
  },
  async getHouseDetail(id) {
    if (!id) return wx.utils.toast('未传入id')
    const { code, data: houseDetail } = await wx.http.get(`/room/${id}`)
    if (code !== 10000) return wx.utils.tosat('获取房屋信息失败')
    // 直接展开数据，减少多余层级
    this.setData({
      ...houseDetail,
    })
  },
  editHouse() {
    wx.navigateTo({
      url: `/house_pkg/pages/form/index?id=${this.data.id}`,
    })
  },
})
